package tech.wetech.admin3.config;

import lombok.Data;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * implements WXPayConfig
 */
@Data
public class WxV3PayConfig {
//  private static String privateKeyPath;

  public static String mchSerialNo = "6E2C8DA885C5D0E1B1725AB89597AFB34BB1A02D";
  public static String appId = "wx7c9f12eecdbb3b29";
  public static String mchId = "1662888364";
  public static String apiV3Key = "MDzLhZJse2AyvoVEpvS8welDuEz8XTNp";
  @Getter
  private static String privateKey = "-----BEGIN PRIVATE KEY-----\n" +
    "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCpWQw7HXZugB6\n" +
    "eOcInWK9nwzjhDAJ1ZEYuX4gFed2caf8P0w0/IQWi9ipxcbHquu//RttuqiiUyqu\n" +
    "Bh/ColJ1mmKW0h2kSqqvq8IY4f+QWG063vzzVJAT/8ANI/i8DbU9HVntpvN9z/Ku\n" +
    "9/fFMk4oTebAhMERJ/hvwJ3WHMPaOSuSNj98ji0cXdoZO8/cu1acJ41C86lGMr34\n" +
    "aBOIvmVCVp+inQh54ZTnY35xj4hTE7RRqNOWimKUs8p3YCtkV50g9Y1yeG4WV2C1\n" +
    "pFSX34vbt8SlamtlOoXZ9LKCYpJKXY540jwQDxFxOHAuPvFCNkvht+pO8RHA8yvu\n" +
    "HJL+LR+fAgMBAAECggEASTU9hq0Y8ifkECwy8OmI/rq4dUX9b2V06jCyAE1cvg6n\n" +
    "WNdRyUgEQhqdBdWOGwDtJEuFKnMfA9Z14fgJsAGvM+46EHG8llNC+UmHeiZeIaMw\n" +
    "igjeaIKwoeT6Dbcu0UPym6bTcO/u+q3gn/BBr1hpTv1lwZjsqJA4/4cZljNBcmyO\n" +
    "y32fad+bZxyS7X5gbnFF7yME0KZIceFXhu5pI9LJjgN7jaE3ZjiJ8pW91Am/NwVF\n" +
    "fnMywAHyxlCu0F1k3eFV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DVesZe2\n" +
    "-----END PRIVATE KEY-----\n";

//  @Value("${wxpay.privateKeyPath}")
//  public void setPrivateKeyPath(String privateKeyPath) {
//    WxV3PayConfig.privateKeyPath = privateKeyPath;
//  }

//  public static String getPrivateKey() {
//    if (privateKey == null) {
//      try {
//        privateKey = new String(Files.readAllBytes(Paths.get(privateKeyPath)), StandardCharsets.UTF_8);
//      } catch (IOException e) {
//        throw new RuntimeException(e);
//      }
//    }
//    return privateKey;
//  }
}
